package com.niiwoo.civet.scheduler.trigger;

import com.alibaba.dubbo.config.annotation.Reference;
import com.niiwoo.civet.trade.service.loan.LoanDubboService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ProjectConfirmOverTimeJobTrigger {

    @Reference(version = "1.0.0")
    LoanDubboService loanDubboService;

    @Scheduled(cron = "${project.return-confirm-overtime-process}")
    public void returnConfirmOverTimeProcess(){
        log.info("==========returnConfirmOverTimeProcessJob invoke start==========");
        try {
            loanDubboService.returnConfirmOverTimeProcess();
        } catch (Exception e) {
            log.error("returnConfirmOverTimeProcessJob invoke error",e);
        }
        log.info("==========returnConfirmOverTimeProcessJob invoke start==========");
    }

    @Scheduled(cron = "${project.pass-confirm-overtime-process}")
    public void passConfirmOverTimeProcess(){
        log.info("==========passConfirmOverTimeProcessJob invoke start==========");
        try {
            loanDubboService.passConfirmOverTimeProcess();
        } catch (Exception e) {
            log.error("passConfirmOverTimeProcessJob invoke error",e);
        }
        log.info("==========passConfirmOverTimeProcessJob invoke start==========");
    }
}
